$(document).ready(function(){
  var slideShow = $(".top-banner"),
    ul = slideShow.find("ul"),
    showNumber = $(".carousel-list i"),
    oneWidth = slideShow.find("ul li").eq(0).width();
  var timer=null;
  var iNow=0;

  showNumber.on("click",function(){
    $(this).addClass("selected").siblings().removeClass("selected");
    var index = $(this).index();
    iNow = index;
    ul.animate({
      "left": -oneWidth*iNow
    })
  });

  function autoPlay(){
    timer = setInterval(function(){
      iNow++;
      if(iNow > showNumber.length-1){
        iNow = 0;
      }
      showNumber.eq(iNow).trigger("click");
    }, 1500);
  }
  autoPlay();

  slideShow.hover(
    function(){
      clearInterval(timer);
    }, autoPlay);
});